package com.zzw.springboot.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 采购单明细实体类
 */
@TableName("t_purchase_item")
public class PurchaseItem implements Serializable {
    // 明细ID
    @TableId(value = "item_id", type = IdType.AUTO)
    private Integer itemId;

    // 采购单ID
    private Integer purchaseId;

    // 商品ID
    @NotNull(message = "商品ID不能为空")
    private Integer productId;

    // 采购数量
    @NotNull(message = "采购数量不能为空")
    @Min(value = 1, message = "采购数量必须大于0")
    private Integer quantity;

    // 单价
    @NotNull(message = "单价不能为空")
    @Min(value = 0, message = "单价不能小于0")
    private BigDecimal unitPrice;

    // 金额
    private BigDecimal amount;

    // 已入库数量
    private Integer receivedQuantity;

    // 备注
    private String remark;

    // 创建时间
    private Date createTime;

    // 更新时间
    private Date updateTime;

    // 非数据库字段
    // 商品名称
    @TableField(exist = false)
    private String productName;

    // 商品编码
    @TableField(exist = false)
    private String productCode;

    // 商品规格
    @TableField(exist = false)
    private String specification;

    // 单位
    @TableField(exist = false)
    private String unit;

    public Integer getItemId() {
        return itemId;
    }

    public void setItemId(Integer itemId) {
        this.itemId = itemId;
    }

    public Integer getPurchaseId() {
        return purchaseId;
    }

    public void setPurchaseId(Integer purchaseId) {
        this.purchaseId = purchaseId;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Integer getReceivedQuantity() {
        return receivedQuantity;
    }

    public void setReceivedQuantity(Integer receivedQuantity) {
        this.receivedQuantity = receivedQuantity;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductCode() {
        return productCode;
    }

    public void setProductCode(String productCode) {
        this.productCode = productCode;
    }

    public String getSpecification() {
        return specification;
    }

    public void setSpecification(String specification) {
        this.specification = specification;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    @Override
    public String toString() {
        return "PurchaseItem{" +
                "itemId=" + itemId +
                ", purchaseId=" + purchaseId +
                ", productId=" + productId +
                ", quantity=" + quantity +
                ", unitPrice=" + unitPrice +
                ", amount=" + amount +
                ", receivedQuantity=" + receivedQuantity +
                ", remark='" + remark + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", productName='" + productName + '\'' +
                ", productCode='" + productCode + '\'' +
                ", specification='" + specification + '\'' +
                ", unit='" + unit + '\'' +
                '}';
    }
}
